package com.student.client.mapper;

import com.student.client.entity.Attendance;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
@Mapper
public interface AttendanceMapper {
    //查询打卡信息
    @Select("select * from attendance_info")
    public List<Attendance> findAllAttendance();

    //添加打卡数据
    @Insert("INSERT INTO attendance_info(attendance_id,attendance_type,start_time,end_time,phonenumber,content,photo_url)" +
            "values(#{attendance_id},#{attendance_type},#{start_time},#{end_time},#{phonenumber},#{content},#{photo_url})" )
    public int addAttendance(Attendance attendance);
    //更新打卡记录
    @Update("update attendance_info set attendance_type = #{1},start_time = #{2},end_time = #{3}," +
            "phonenumber = #{4},content = #{5},photo_url = #{6} where id=#{0}")
    public int updAttendance(String id,
                             String attendance_type,
                             String start_time,
                             String end_time,
                             String phonenumber,
                             String content,
                             String photo_url);


    @Delete("delete from attendance_info where attendance_id=#{attendance_id}")
    public int delAttendance(String attendance_id);
}